import React, { Component } from 'react'

type Props = {
  x: number
  y: number
  children: string
}

export default class Position extends Component<Props> {
  /*   state = {
    x: 0,
    y: 0,
  }
  move = (e: MouseEvent) => {
    this.setState({
      x: e.pageX,
      y: e.pageY,
    })
  }
  componentDidMount(): void {
    document.addEventListener('mousemove', this.move)
  }
  componentWillUnmount(): void {
    document.removeEventListener('mousemove', this.move)
  } */
  render() {
    const { x, y } = this.props
    return (
      <div>
        <p>{this.props.children}</p>
        <h3>
          x: {x} y: {y}
        </h3>
      </div>
    )
  }
}
